package com.yl.ydk.ui.adapter

import android.widget.ImageView
import com.yl.ydk.R
import com.yl.ydk.bean.VideoListBean
import com.yl.ydk.utils.GlideUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder

class HealthyVideoAdapter(data: MutableList<VideoListBean.Data.DataX>?) :
    BaseQuickAdapter<VideoListBean.Data.DataX, BaseViewHolder>(
        R.layout.item_healthyvideo,
        data
    ) {

    override fun convert(helper: BaseViewHolder?, item: VideoListBean.Data.DataX?) {
        val ivCoverSrc = helper?.getView<ImageView>(R.id.ivCoverSrc)
        GlideUtils.load_e8_bg(mContext, item?.cover_src, ivCoverSrc)
        helper?.setText(R.id.tvTitle, item?.title)
        helper?.itemView?.setOnClickListener {
            onItemClick?.onListItemClick(item)
        }
    }

    private var onItemClick: onListItemClick? = null

    interface onListItemClick {
        fun onListItemClick(item: VideoListBean.Data.DataX?)
    }

    fun onListItemClick(onListItemClick: onListItemClick?) {
        this.onItemClick = onListItemClick
    }


}